return "DROPDOWN LIST" & RETURN & RETURN & "Drop this behavior on a field member to create a pop-up list. " & "Animations continue while the the list is kept open." & RETURN & RETURN & "When the user clicks on the sprite, the dropdown list opens to reveal all its items. " & "If the user immediately releases the mouse, the menu remains open until the next click. " & "When the user selects a menu item, the menu closes up to displays the selected item. " & "If the user clicks elsewhere, the menu closes to display the previously selected item." & RETURN & RETURN & "You can use one of two modes for the dropdown list:" & RETURN & "1) To allow the user to make a selection." & RETURN & "2) To execute a simple command." & RETURN & RETURN & "SELECTION" & RETURN & RETURN & "In the first case, you will need to determine what the user selected. " & "To interrogate the dropdown list, use syntax similar to the following:" & RETURN & RETURN & " put sendAllSprites (#DropList_Selection, 'listName')" & RETURN & RETURN & "This returns a property list with all the necessary information:" & RETURN & RETURN & "-- [#item: 1, #text: 'First choice', #type: #content, #sprite: 1]" & RETURN & RETURN & "See the Notes for developers in the script itself for more details." & RETURN & RETURN & "You can choose any character to act as a checkmark to indicate the previous selection when the dropdown list is open. " & "Depending on the font you use, you may wish to use a checkmark followed by a space. " & "Reopen the Behavior Parameters dialog to make such a change." & RETURN & RETURN & "EXECUTION" & RETURN & RETURN & "You can choose to execute three types of command:" & RETURN & "a) go marker (<selected item>)" & RETURN & "b) go movie '<selected item>'" & RETURN & "c) do '<selected item>'" & RETURN & RETURN & "The type of command depends on the contents of the list. " & "The behavior can automatically create a list of markers in the current movie, or movies in the current folder... " & "or it can leave the contents of the field as they are. " & "In this last case, choosing Execute makes the behavior treat the selected item as a Lingo command. " & "You should include handlers in a movie script to deal with such commands." & RETURN & RETURN & "TIP: Place the dropdown list sprite in a high channel where it will not be covered by any other sprites." & RETURN & RETURN & "PERMITTED MEMBER TYPES:" & RETURN & "field" & RETURN & RETURN & "PARAMETERS:" & RETURN & "* Name of the list (used in sendAllSprite calls)" & RETURN & "* Purpose - Choose between:" & RETURN & " - Marker: creates a list of markers in current movie" & RETURN & " - Movie: creates a list of movies with the same pathName" & RETURN & " - Field contents: uses the current contents of the field" & RETURN & "* Action on selection - Choose between:" & RETURN & " - Execute: go movie | go marker | do selectedLine" & RETURN & " - Select: return the selected item if called to do so" & RETURN & "* Checkmark to indicate currently selected item" & RETURN & "* Standard style: deselect this option if you want to give the field member a particular border, margin or shadow." & RETURN & RETURN & "PUBLIC METHODS:" & RETURN & "* Get info on currently selected item" & RETURN & "* Set the contents of the dropdown list" & RETURN & "* Toggle between Execute and Select modes" & RETURN & "* Get behavior reference"
end
on getBehaviorTooltip me
return "Use with field members only." & RETURN & RETURN & "Turn a field into a pop-up list to execute commands or store selected data. " & "See the Behavior Description for tips on executing items with the 'do' command or accessing the currently selected item using Lingo." & RETURN & RETURN & "Options: Create a list of movies with the same path name, or a list of markers in the current movie."
end
on beginSprite me
Initialize(me)
end
on mouseDown me
if not myListIsOpen then
OpenList(me)
end if
end
on prepareFrame me
CheckListState(me)
end
on mouseUp me
CheckClick(me)
end
on mouseUpOutSide me
CloseList(me)
end
on CheckListState me
if myListIsOpen then
if the clickOn <> spriteNum then
CloseList(me)
else
HiliteSelection(me)
end if
else
if (myContent = #marker) and myAction then
markerNumber = GetCurrentMarker(me)
if mySelectedItem = markerNumber then
exit
end if
mySelectedItem = markerNumber
ScrollTo(me, mySelectedItem)
end if
end if
end
on OpenList me
myClickTicks = the ticks
myListIsOpen = 1
myDisplayString = myRestoreString
if not myAction then
put myCheckmark into myDisplayString.line[mySelectedItem].char[1..2]
return [#myName: [#comment: "Name of this list", #format: #string, #default: "List" & the currentSpriteNum], #myContent: [#comment: "Contents of list", #format: #string, #range: ["Current contents of the field", "Markers in this movie", "Movies with the same path name"], #default: "Current contents of the field"], #myAction: [#comment: "Purpose of list", #format: #string, #range: ["Select: return the selected item when called", "Execute: go movie | go marker | do selectedLine"], #default: "Select: return the selected item when called"], #myCheckmark: [#comment: "Checkmark to indicate currently selected item", #format: #string, #default: ">"], #myStandard: [#comment: "Use standard style?", #format: #boolean, #default: 1]]